home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Tool Chest / Dev.CD May 97 TC.toast / Tool Chest / Localization / Verifier 1.0 / install < prev    next >
Encoding:
Text File  |  1994-02-02  |  3.4 KB  |  123 lines  |  [TEXT/MPS ]

  1. #
  2. #    File: Install, MPW Shell script
  3. #    by Kerry Laidlaw
  4. #    2/19/93
  5. #    Apple Computer, Inc.
  6. #
  7. #    Function:
  8. #    Install or uninstall the Localization Verifier into a user's system.
  9. #
  10. #    In-Outputs:
  11. #    None.
  12. #
  13. #
  14.  
  15. #    Save some initial shell variable values, and set them for our own use
  16.  
  17.     set saveExit    {exit}
  18.     set exit    0        # Set exit 0 so we won't abort if status variable is non-zero
  19.     set saveEcho {echo}    # echo=1 for echoing each command before execution
  20.     set echo 0
  21.     set saveDir `directory`
  22.  
  23. #    Make sure we have access to the names of the Verifier files.
  24. #    The v.setFilenameVars script will define the following variables:
  25. #        masterFiles = all the files that consistute the Verifier
  26. #        toolFiles = all MPW tools used by the Verifier
  27. #        scriptFiles = all MPW scripts used by the Verifier
  28.     
  29.     execute v.setFilenameVars
  30.  
  31.     #    Make sure all the files are there to install from!
  32.  
  33.     for vFile in {masterFiles}
  34.         if !"`exists -f "{vFile}"`"
  35.             alert "The Verifier Installation failed:    ∂
  36.                     ∂nThe file ∂""{vFile}"∂" could not be found.    ∂
  37.                     ∂n∂nPlease set the directory to the Verifier∂'s install folder."
  38.             set echo    {saveEcho}             # restore echo
  39.             set exit    "{saveExit}"
  40.             exit 2
  41.         end
  42.     end
  43.     
  44. #    Find out if we're installing or removing.
  45.  
  46. if ("`exists -f "{MPW}"Scripts:v.menu`")    ||    ("`exists -f "{MPW}"Scripts:verify-menu`")
  47. #    We should be removing. Make sure they want to remove the Verifier.
  48.     Confirm "Do you want to install over the current Localization Verifier?"
  49.     if {status} != 0            # The cancel button
  50.         set echo    {saveEcho}             # restore echo
  51.         set exit    "{saveExit}"
  52.         exit 2
  53.     end
  54.  
  55.     #    Destroy old files from previous versions of the Verifier
  56.     
  57.     delete -i -p "{MPW}"Scripts:verify-menu    
  58.     delete -i -p "{MPW}"Scripts:check-disk
  59.     delete -i -p "{MPW}"Scripts:compare-disks
  60.     delete -i -p "{MPW}"Scripts:makelist    
  61.     delete -i -p "{MPW}"Scripts:make.rnames    
  62.     
  63.     #    Delete the current files in both the Scripts and Tools folders.                    
  64.  
  65.     for vFile in {toolFiles}
  66.         delete -i -p "{MPW}"Tools:"{vFile}"                
  67.     end
  68.     
  69.     for vFile in {scriptFiles}
  70.         delete -i -p "{MPW}"Scripts:"{vFile}"                
  71.     end
  72.  
  73.     #    Remove the menu.
  74.     deletemenu "Verify" > dev:null ≥ dev:null
  75.     open "{ShellDirectory}"UserStartup
  76.     find • "{ShellDirectory}"UserStartup
  77.     loop
  78.         clear "/#∂tMake the menu for the Localization Verifier.∂n/" "{ShellDirectory}"UserStartup
  79.         if {status} != 0
  80.             break
  81.         end
  82.         
  83.         clear "/verify-menu∂n/" "{ShellDirectory}"UserStartup
  84.         
  85.         clear "/v.menu∂n/" "{ShellDirectory}"UserStartup
  86.  
  87.     end
  88.  
  89.     close -y "{ShellDirectory}"UserStartup
  90.     
  91. end        #    if installing over old verifier
  92.  
  93.     
  94.     #    Copy over the files to the Scripts/Tools folders as appropriate.                    
  95.  
  96.     for vFile in {toolFiles}
  97.         duplicate -c -p "{vFile}"    "{MPW}"Tools:            
  98.     end
  99.     
  100.     for vFile in {scriptFiles}
  101.         duplicate -c -p "{vFile}"    "{MPW}"Scripts:            
  102.     end
  103.     
  104.     #    If the user didn't supply the "ISS" parameter then remove the rNames creation functionality
  105.     
  106.     if `evaluate "{1}" !~ /[iI][sS][[sS]/`
  107.         delete -i -p "{MPW}"Scripts:v.rnames    
  108.     end
  109.     
  110. #    Add the new menu.
  111. #echo "Adding the menu command to your UserStartup file..."
  112.  
  113. echo "#∂tMake the menu for the Localization Verifier."  >> "{ShellDirectory}"UserStartup
  114. echo "v.menu"  >> "{ShellDirectory}"UserStartup
  115. v.menu        # Make the menu right now too.
  116.  
  117. Alert "The SCM Verifier has been installed into your MPW system."
  118.     
  119. #    Restore shell variables and exit
  120.  
  121.     directory    "{saveDir}"            # Leave the directory setting unchanged
  122.     set echo    {saveEcho}             # restore echo
  123.     set exit    "{saveExit}"